<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<body>
	<ui:composition template="/pages/protected/user/default.xhtml">
		<ui:define name="content">
			<h:form>
				<p:dataTable value="#{categoryMB.allCategories}" var="category"
					styleClass="table" headerClass="tableColumnsHeader"
					rowClasses="tableOddLine,tableEvenLine">
					<p:column>
						<f:facet name="header">
							#{msgs.categoryname}
						</f:facet>
						#{category.name}
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msgs.actions}
						</f:facet>
						<h:inputHidden value="#{category.id}" />
						<h:commandButton action="#{categoryMB.deleteCategory()}"
							value="#{msgs.delete}"
							onclick="if (!confirm('#{msgs.areYouSure}')) return false">
							<f:setPropertyActionListener target="#{categoryMB.category}"
								value="#{category}" />
						</h:commandButton>
					</p:column>
				</p:dataTable>

				<h:link outcome="createCategory" value="#{msgs.create}" />
			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>